package com.codrim.cs.data.server.dao.entity;

import com.codrim.cs.data.rpc.dto.result.TopAffiliateConversionResultDTO;

import java.util.Optional;

import lombok.Data;

/**
 * @author Liang.Zhuge
 * @date 07/12/2017
 */
@Data
public class TopAffiliateConversionDO {
    private Integer affiliateId;
    private Long conversion;

    public TopAffiliateConversionResultDTO toDto() {
        TopAffiliateConversionResultDTO dto = new TopAffiliateConversionResultDTO();
        dto.setAffiliateId(this.affiliateId);
        dto.setConversions(Optional.ofNullable(this.conversion).map(Long::intValue).orElse(null));
        return dto;
    }
}
